import urllib.request
import urllib.error


if __name__ == '__main__':
    url = 'http://www.doudan1111.com'
    headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0'}
    try:
        request = urllib.request.Request(url=url, headers=headers)
        opens = urllib.request.urlopen(request)
        com = opens.read().decode('utf8')
        print(com)
    except urllib.error.HTTPError:
        print('系统在升级')
    except urllib.error.URLError:
        print('系统在升级')


